//
//  LXJFansDetailsViewModel.swift
//  XJWeiBo
//
//  Created by 李旭杰 on 2017/4/9.
//  Copyright © 2017年 李旭杰. All rights reserved.
//

import UIKit

class LXJFansDetailsViewModel: NSObject {
    
    /// 模型属性
    var fansDetails: LXJFansInfoModel?{
        didSet{
            /// 获取 weibo 认证类型
            let verifiedType = fansDetails?.verified_type
            verifiedTypeImageHandle(verifiedType: verifiedType!)
            
            /// 发表时间
            let desc = fansDetails?.desc
            descriptionTextHandle(desc: desc ?? "")
        }
    }
    
    /// 认证类型图片处理
    var verifiedTypeImage: UIImage?
    /// 认证类型 -1：没有认证，0,1，认证用户，2,3,5: 企业认证，220: 达人
    fileprivate func verifiedTypeImageHandle(verifiedType: Int) -> Void {
        switch verifiedType {
        case 0,1:
            verifiedTypeImage = UIImage(named: "avatar_vip")
            
        case 2,3,5:
            verifiedTypeImage = UIImage(named: "avatar_enterprise_vip")
            
        case 220:
            verifiedTypeImage = UIImage(named: "avatar_grassroot")
            
        default:
            verifiedTypeImage = nil
        }
    }
    
    /// 个性签名处理
    var descript: String?
    fileprivate func descriptionTextHandle(desc: String) -> Void {
        if desc == "" {
            descript = "这个人很懒,什么都没有留下!"
        } else{
            descript = desc
        }
    }
    
}
